# Makefile for NETCONF entire source directory
#  
#   src directory

##################### PROGRAMS ########################
##################### LIBRARIES ########################
#
# Check if this is a DEBIAN package build for
# the target, which will be 1 of:
#   SHLIBS, CLIENT, SERVER, DEVELOPER, SOURCE
#
# if not a DEBIAN build then none of these environment
# variables will be defined, so it is either a normal
# developer build or an RPM package build

ifdef CLIENT
APPS = yangdump yangdiff yangcli
DIRS = mgr ydump $(APPS)
else
ifdef SERVER
APPS = subsys netconfd
DIRS = agt $(APPS)
else
ifdef DEVELOPER
APPS = 
DIRS = agt ydump ncx $(APPS)
else
ifdef SHLIBS
APPS =
DIRS = ncx
else
APPS = subsys netconfd yangdump yangdiff yangcli
DIRS = agt mgr ncx ydump $(APPS)
endif
endif
endif
endif

#################### PLATFORM DEFINITIONS ############

all: treeall

include platform/platform.profile

################################ MAKE RULES #################################
#


depend: treedepend

clean: treeclean

superclean: treesuperclean

distclean: treedistclean

test: treetest

lint: treelint

install: treeinstall

uninstall: treeuninstall

notabs: treenotabs

addheader: treeaddheader

fixcopyright: treefixcopyright

setuptarget:
	mkdir -p ../target
	mkdir -p ../target/bin
	mkdir -p ../target/lib
	for dir in $(DIRS); do\
	  mkdir -p ../target/$$dir;\
	done

treeall: setuptarget
	/bin/sh platform/setversion.sh
	for dir in $(DIRS); do\
	  cd $$dir && $(MAKE) $(JFLAG) all && cd ..;\
        done

treedepend:
	for dir in $(DIRS); do\
	  cd $$dir && $(MAKE) $(JFLAG) depend && cd ..;\
        done

treeclean:
	for dir in $(DIRS); do\
	  cd $$dir && $(MAKE) clean && cd ..;\
        done

treesuperclean:
	for dir in $(DIRS); do\
	  cd $$dir && $(MAKE) superclean && cd ..;\
        done

treedistclean:
	for dir in $(DIRS); do\
	  cd $$dir && $(MAKE) distclean && cd ..;\
        done

treetest: setuptarget
	for dir in $(DIRS); do\
	  cd $$dir && $(MAKE) $(JFLAG) test && cd ..;\
        done

treelint:
	for dir in $(DIRS); do\
	  cd $$dir && $(MAKE) $(JFLAG) lint && cd ..;\
        done

treeinstall:
	for dir in $(DIRS); do\
          cd $$dir && $(MAKE) install && cd ..;\
        done

treeuninstall:
	for dir in $(DIRS); do\
          cd $$dir && $(MAKE) uninstall && cd ..;\
        done

treenotabs:
	for dir in $(DIRS); do\
          cd $$dir && $(MAKE) notabs && cd ..;\
        done

treeaddheader:
	for dir in $(DIRS); do\
          cd $$dir && $(MAKE) addheader && cd ..;\
        done


treefixcopyright:
	for dir in $(DIRS); do\
          cd $$dir && $(MAKE) fixcopyright && cd ..;\
        done

.PHONY: depend clean superclean test lint install \
	treeall treedepend treeclean treesuperclean \
	treetest treelint treeinstall notabs treenotabs \
	addheader treeaddheader uninstall treeuninstall \
	distclean treedistclean fixcopyright treefixcopyright \
	setuptarget

# prevent the make program from choking on all the symbols
# that get generated from autogenerated make rules
.NOEXPORT:



